package com.kuangstudy.common.date;

import java.util.Date;

/**
 * ClassName: UnsafeBuyTicket
 * date: 2021/07/14 18:43:08
 *
 * @author zlk
 */
public class Demo1 {
    public static void main(String[] args) {
        /*当前时间*/
        Date date = new Date();
        System.out.println(date.toLocaleString());
        /*昨天时间*/
        Date date1 = new Date(date.getTime() - (60 * 60 * 24 * 1000));
        System.out.println(date1.toLocaleString());
        /*方法after before*/
        boolean after = date.after(date1);
        System.out.println(after);
        boolean before = date.before(date1);
        System.out.println(before);
        /*比较compareTo() equals*/
        int i = date.compareTo(date1);
        System.out.println(i);
        boolean equals = date.equals(date1);
        System.out.println(equals);
    }
}
